<?php
/*
// @author : lael
// blog : http://hi.baidu.com/lael80
// http://www.gzyd.net
// all right reserved.
*/
namespace ydsdk\models;
class user extends \ydsdk\core\common {
	public function __construct(){
		parent::__construct();
	}

	 /**
	 * list friend by uid   
	 * 
	 * @access  public
	 * @return  result_array,
	 */       
	public function get_list_friend($uid,$status=0)
	{
		$uid = intval($uid);
		$sql = 'SELECT u.id, u.openid, u.`name`, u.`status`,is_wx_notic FROM ##deerxi_user AS u INNER JOIN ##deerxi_follow AS f ON u.id = f.uid OR u.id = f.sid WHERE f.type = 1 AND f.uid = '.$uid.'';
		if($status==1)
		{
			$sql = $sql.' AND u.`status`=1 AND is_wx_notic=1';
		}
		$res = $this->db->select($sql);
		
		$sql2 = 'SELECT  id,  openid, `name`,  `status`,is_wx_notic FROM ##deerxi_user where id='.$uid.'';
	    $res2 = $this->db->get_row($sql2);
		array_push($res,$res2);
		return $res;
	}	
}